/*
interface InterfacePerson {
    name: string
    age: number
    height: number
}

const person: InterfacePerson = {
    name: "陶品奇",
    age: 18,
    height: 188
}
console.log(person.name, person.age, person.height)*/


/*interface InterfaceInfo {
     索引签名：可以通过字符串索引，去获取到一个值，也是字符串
    [key: string]: string
}

function getInfo(): InterfaceInfo {
    const value: any = "哈哈哈"
    return value
}
const info:InterfaceInfo=getInfo()
const names:string=info["name"]*/


interface InterfaceCollection {
    // 索引签名 index索引是number类型 返回值是string类型
    [index: number]: string
    // length number类型
    length: number
}

function printCollection(collection: InterfaceCollection): void {
    for (let i: number = 0; i < collection.length; i++) {
        console.log(collection[i])
    }
}

const array: string[] = ["a", "b", "c"]
const tuple: [string, string] = ["why", "广州"]

printCollection(array)
printCollection(tuple)